package com.k8.cluster.clusterInvokerImpl;

import com.k8.rpc.invoke.Invoker;
import com.k8.rpc.invoke.invocation.Invocation;
import com.k8.rpc.result.Result;


/**
 * @Author: k8
 * @CreateTime: 2025-03-20
 * @Version: 1.0
 */
public class FailFastClusterInvoker<T> extends AbstractSessionSupportClusterInvoker<T> {
    private Class<T> type;


    @Override
    public void setInterface(Class<T> type) {
        this.type = type;
    }


    @Override
    public Class<T> getInterface() {
        return this.type;
    }

    @Override
    public Result doInvoke(Invocation invocation) throws Throwable {
        Invoker<T> invoker = loadBalance.nextInvoker();
        return invoker.invoke(invocation);
    }
}
